package com.eshin.testcontext;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties
public class TestContextAutoConfiguration {

	
	@Value("${testcontext.name:hello}")
	String name;
	@Value("${testcontext.show.test:dshow}")
	String show;
	@Value("${testcontext1.show.test:dshow}")
	String show1;
	
	@Bean
	@ConditionalOnMissingBean
	public ITestContext getTestContext(){
		System.out.println(show);
		System.out.println(show1);
		return new MyContextBean(name);
	}
}
